package src.com.foreknow.demo5;

import java.util.Scanner;

public class Manager {
    //登录（根据用户和密码）  select * from user where username= and password=
    public static boolean login(String username,String password){
        //System.out.println("select * from user where username=  and password=");
      return true;
  }
    //注册（填写用户名和密码） insert into user(username,password) values()
    public  static boolean register(String username,String password){
        return true;
    }

    //根据id查询用户名     select username from user where id=
    public  static String getQueryByIdName(int id){
        Scanner input = new Scanner(System.in);
        String username = input.next();
        return username;

    }

    //根据id删除用户   delete from user where di
    public static boolean deleteById(int id){
        return false;
    }

    //修改用户信息（修改用户名和密码）update user set username=  ,password=  where di=
    public  static int update(String username){
        return 1;
    }

    //查询所有用户信息 select * from user
    public static String[] getQueryByNames(){
        String [] array = new String[10];
        array[0] = "tom";
        array[1] = "blues";
        return array;
    }
   

    public static void main(String[] args) {
        //将调用方法的返回结果赋值给arr变量
        String[] arr = Manager.getQueryByNames();
        //遍历输出数组中的数据
        for (int i = 0;i<arr.length;i++){
            System.out.println(arr[i]);
        }

        //修改用户信息
        // 1.先根据id查询用户的信息
        String username = Manager.getQueryByIdName(1);
        // 2.修改用户信息
       int isRight =  Manager.update(username);
       if (isRight==1){
           System.out.println("success....");
       }else {
           System.out.println("error.....");
       }




//        Scanner input = new Scanner(System.in);
//        System.out.println("请输入用户名：");
//        String username = input.next();
//        String name = Manager.getQueryByIdName(1);
//        System.out.println(name);


//        Scanner input = new Scanner(System.in);
//        System.out.println("请输入用户名：");
//        String username = input.next();
//        System.out.println("请输入密码：");
//        String password = input.next();
//        boolean isRight = Manager.login("tom","123456");
//        if (isRight){
//            System.out.println("登录成功....");
//        }else {
//            System.out.println("登录失败....");
//        }
    }

}





















